//
//  CYProjectDetail_JieShaoCollectionViewCell.m
//  cyydt
//
//  Created by chu on 2019/1/24.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYProjectDetail_JieShaoCollectionViewCell.h"

@implementation CYProjectDetail_JieShaoCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.guanzhuBtn.layer.cornerRadius = self.guanzhuBtn.frame.size.height / 2;
    self.guanzhuBtn.layer.masksToBounds = YES;
    self.guanzhuBtn.layer.borderWidth = 1;
    self.guanzhuBtn.layer.borderColor = RGBOF(0x999999).CGColor;

//    [UIView animateWithDuration:0.1 animations:^{
//        self.indiaImageView.transform = CGAffineTransformMakeRotation(M_PI);
//    }];
}

- (void)setModel:(CYProjectModel *)model{
    _model = model;
    if ([model.is_collect integerValue] == 1) {
        self.guanzhuBtn.selected = YES;
    }else{
        self.guanzhuBtn.selected = NO;
    }
    
    if ([model.isOpen boolValue]) {
        self.contentLabel.text = model.content;
        self.marginTopConstraint.constant = 15;
        self.marginBottomConstraint.constant = 15;
    }else{
        self.contentLabel.text = @"";
        self.marginTopConstraint.constant = 0;
        self.marginBottomConstraint.constant = 0;
    }
}

- (IBAction)openAction:(UIButton *)sender {
    if (![self.model.isOpen boolValue]) {
        [UIView animateWithDuration:0.1 animations:^{
            self.indiaImageView.transform = CGAffineTransformMakeRotation(M_PI);
        }];
    }else{
        [UIView animateWithDuration:1 animations:^{
            self.indiaImageView.transform = CGAffineTransformIdentity;
        }];
    }
    
    if (self.openBlock) {
        self.openBlock();
    }

}

- (IBAction)guanzhuAction:(UIButton *)sender {
    if (self.guanZhuBlock) {
        self.guanZhuBlock();
    }
}

@end
